#!/usr/bin/ruby -w
# Created by Luis Campo Giralte

require "../src/ruaiengine"

def callback_domain(flow)
    print "Malware domain on:%s" % flow
end

def load_bad_domains

    d = DomainNameManager.new
    file = File.new("zeus.dat","r")
    while (line = file.gets)
        dom = DomainName.new("Domain %s" % line.chomp,line.chomp)
        dom.callback = method(:callback_domain)
        d.add_domain_name(dom)
    end
    file.close
    return d
end

d = load_bad_domains()

s = StackLan.new
pd = PacketDispatcher.new
pd.stack = s

s.total_tcp_flows = 2000
s.total_udp_flows = 2000

s.set_domain_name_manager(d,"HTTPProtocol")

pd.open("ens7")
begin
    pd.run()
rescue
    print "Stop capturing packets"
end

pd.close()

